package com.ma.schoolproject.controller;

import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ma.schoolproject.config.FileProperties;
import com.ma.schoolproject.entitys.Book;
import com.ma.schoolproject.entitys.User;
import com.ma.schoolproject.mapper.UserMapper;
import com.ma.schoolproject.utils.FilesUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.Map;

@RestController
@RequestMapping("/text")
public class TextController {
    @Autowired
    private FilesUtils filesUtils;
    @Autowired
    private UserMapper userMapper;
    @PostMapping("/file")
    public SaResult testFile(@RequestParam("file")MultipartFile file){
        Map<String, Object> upload = filesUtils.upload(file);
        return SaResult.ok(upload.get("fileName").toString());
    }
}
